const axios = require('axios')

// 通过 axios 拦截器设置请求头 主要用于加入 cookie
module.exports = (headers = {}) => {
  axios.interceptors.request.use(config => {
    for ([k, v] of Object.entries(headers)) {
      config.headers[k] = v
    }
    return config
  })
}